Repository navigation
Conversation
|
We might want to discuss whether we want to introduce this library https://github.com/dnault/therapi-runtime-javadoc Which brings annotations and an annotation processor that writes annotations capturing the Javadoc to |
c868aae to
c23e0d6
Compare
c23e0d6 to
1ad9db8
Compare
373f1ed to
bbdd443
Compare
unp1
left a comment
There was a problem hiding this comment.
Thanks! Concerning the failing WD test, that constructor for ConstantCondition takes a JAbstractSortedOperator which is not a parseable variable.
(also "\reference" does not take a variable)
2e7edc3 to
7fa9eb6
Compare
7fa9eb6 to
981dedd
Compare
Determining whether a varcond implementation supports negation no longer matches the declared ArgumentType classes against the constructor's parameter types. The argument types are only coarse categories used for parsing and do not match the concrete parameter types (e.g. \isConstant expects an ArgumentType.VARIABLE, but ConstantCondition's constructor takes a JAbstractSortedOperator). A failed match made isNegationSupported throw an IllegalStateException, which was swallowed by TacletPBuilder's manipulator application, so the varcond could not be applied at all and taclet files using \isConstant or \hasLabel failed to load, breaking all key.core.wd run-all-proofs tests. The negation support check is restored to the previous lenient behavior: the first declared public constructor's last parameter must be boolean. Constructor lookup for documentation purposes now matches by parameter count and falls back to empty javadoc if the class was not processed by the therapi scribe. Also fix the warning in TacletPBuilder to print the argument types array instead of its identity.
Reintroduces the check that a varcond implementation constructor matches the declared ArgumentTypes, which was dropped as part of the initial fix for the wd proof tests. The negation-support detection is now tiered: a constructor whose parameter types are compatible with the declared argument types is preferred and decides negation support by its trailing boolean parameter. Only if no type-compatible constructor exists (the ArgumentType categories only approximate the real parameter types, as for \isConstant and \hasLabel), the previous lenient fallback on the first public constructor is retained. findConstructor (used for documentation lookup) prefers a type-compatible constructor and falls back to matching by parameter count. Verified: :key.core.wd:testRunAllWdProofs passes 9/9.
The documentation generators (VarcondDoc, ScriptDoc) extract Javadocs via therapi from de.uka.ilkd.key.rule.conditions and de.uka.ilkd.key.scripts. Complete the gaps so the generated documentation is not empty: - rule.conditions: add missing class documentation (ArrayLength, DifferentInstantiation, DropEffectlessElementaries, DropEffectlessStores, EqualUnique, FreeLabelIn, MetaDisjoint, Observer, SimplifyIfThenElseUpdate) and constructor documentation with @PARAM descriptions for all variable condition implementations and TypeResolver's nested resolvers; fix the copy-pasted class documentation of IsThisReference. - scripts: document TermWithHoles and SequentWithHoles, fill the empty class documentation of the deprecated SchemaVarCommand, and add the missing class-level @documentation to the Parameters classes of branches, expandDef, rewrite, and set. - normalize license headers to the spotless template (ScriptDoc, VarcondDoc, TacletBuilderCommandInfo).
…build Add the Gradle tasks generateVarcondDoc and generateScriptDoc, which run the documentation generators (VarcondDoc, ScriptDoc) and write the resulting markdown to key.core/build/docs/keydocs. The nightly workflow additionally sets up JDK 25 for the generation step (therapi's scribe only extracts '///' markdown javadocs on JDK 23+), packages the generated files and uploads them as the artifact "varcond-script-docs" with a retention of 30 days.
- ArgumentsLifter: null-guard the therapi javadoc lookups, which return null for classes compiled with a JDK that does not recognize the used doc comment style, and format field javadoc comments with the CommentFormatter instead of printing the raw FieldJavadoc object. - TacletBuilderCommandInfoImpl: bound the @PARAM name lookup by the documented parameter count, which may be shorter than the declared argument types.
…riptDoc Extract the common functionality of the documentation generators into the new base class AbstractDocGenerator: - output handling: the generators write to stdout, or to the file given as the first command line argument (creating missing directories), which simplifies the Gradle tasks generateVarcondDoc/generateScriptDoc - javadoc post-processing: cleanJavadoc and indent are moved here and are now also applied by ScriptDoc - ScriptDoc additionally prints a section header per command, matching the format of VarcondDoc
The generators now also emit a structured JSON dump next to the markdown file (varconds.json, script-commands.json), containing the same information in a machine-readable form: names, categories, deprecation flags, descriptions, signatures with negation support, and arguments with kind, type, position and description. The shared base class AbstractDocGenerator gains a generateJsonData() hook; the new dependency-free JsonWriter serializes the data. The nightly workflow's packaging step picks the JSON files up unchanged.
|
Current version:
|
1f9fc2e to
c94ff2d
Compare
Related Issue
This pull request does not resolve a specific issue; it continues and extends the
documentation-generation feature of this branch.
Intended Change
This PR adds the generation of user documentation for the taclet language constructs —
variable conditions (varconds) and proof script commands — and fixes the varcond
builder machinery that was broken by the initial version of this feature:
Fix broken rule loading (regression on this branch):
TacletBuilderCommandInfo.isNegationSupported()threw an
IllegalStateExceptionfor varcond implementations whose constructorparameter types do not match the declared
ArgumentTypecategories (e.g.\isConstant,\hasLabel). The exception was swallowed byTacletPBuilderandsurfaced as
semanticError("Could not apply the given variable condition"),which made the wd rule files (
wdGeneralRules.key,wdFormulaRules.key) fail toload, breaking all 8 wd proofs. Negation detection is now tiered: a constructor
whose parameter types are compatible with the declared argument types decides
negation support by its trailing
booleanparameter; only if no type-compatibleconstructor exists, the lenient fallback on the first public constructor is used.
findConstructor(documentation lookup) prefers type-compatible constructors andfalls back to matching by parameter count.
Documentation generators:
VarcondDoc(all registered varconds) andScriptDoc(all proof script commands) render Markdown and structured JSONdumps. The shared functionality lives in the new base class
AbstractDocGenerator(output target handling, javadoc post-processing,generateJsonData()hook) and the dependency-freeJsonWriter.Gradle integration: new tasks
:key.core:generateVarcondDocand:key.core:generateScriptDocwritingvarconds.md/varconds.jsonandscript-commands.md/script-commands.jsontokey.core/build/docs/keydocs.Nightly deployment: the nightly workflow additionally sets up JDK 25
(therapi's scribe only extracts
///markdown javadocs on JDK 23+), runs thegeneration tasks, packages the results as
key-varcond-script-docs.zipanduploads them as the separate artifact
varcond-script-docswith a retentionof 30 days.
Javadoc completion: missing class and constructor documentation of the
varcond implementation classes in
de.uka.ilkd.key.rule.conditions(which feedVarcondDoc) and gaps inde.uka.ilkd.key.scriptswere completed, so thegenerated documentation is not empty.
Plan
ArgumentType-vs-parameter-type check in a tiered designrule.conditionsandscriptsgenerateVarcondDoc/generateScriptDocKeYProject/key-docs) to download the artifact intodocs/userand add the pages to the navType of pull request
Ensuring quality
./gradlew :key.core.wd:testRunAllWdProofspasses 9/9 with the reintroduced type checks../gradlew :key.core:generateVarcondDoc :key.core:generateScriptDocproduce completeMarkdown and JSON files (53 varconds, 39 commands); the generated files were validated.
(The reflection-based matching is only used for negation detection and documentation
lookup, and the negation result is cached per command info.)
Additional information and contact(s)
The generated documentation is uploaded by the nightly workflow as the artifact
varcond-script-docs; the corresponding download step for the key-docs repository(
mkdocs.yml) will be contributed there separately.The contributions within this pull request are licensed under GPLv2, or (at your option) any later version, for inclusion in KeY.